<!doctype html>
<html lang="en" class="fixed">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>课程列表</title>
    <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png">
    <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png">
    <link rel="stylesheet" type="text/css"
          href="<?php xcho(loadSource('/assets/plugins/bootstrap/css/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/animate.css/animate.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/font-awesome/css/font-awesome.css')) ?>">
    <link rel="stylesheet"
          href="<?php xcho(loadSource('/assets/plugins/data-table/media/css/dataTables.bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/layui/css/layui.css')) ?>" media="all">
    <!--    <link rel="stylesheet" href="-->
    <?php //xcho(loadSource('/assets/plugins/ztree/css/zTreeStyle/zTreeStyle.css')) ?><!--">-->
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/ztree/css/metroStyle/metroStyle.css')) ?>"
          type="text/css">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/css/new_main.css')) ?>">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        ul, li, ol, li {
            list-style: none;
        }

        .content-title {
            /*width: 1200px;*/
            padding: 20px;
            background: #fff;
            margin: 0 auto;
        }

        .content-title .title {
            border-bottom: 1px #ccc solid;
            font-size: 0;
        }

        .content-title .title p {
            width: 60px;
            text-align: center;
            font-size: 14px;
            color: #108EE9;
            display: inline-block;
            position: relative;
        }

        .content-title .title p i {
            width: 70px;
            display: inline-block;
            border-bottom: 2px #108EE9 solid;
            position: absolute;
            bottom: -11px;
            left: 0;
        }

        .content-title .title ul {
            font-size: 0;
            display: inline-block;
            float: right;
        }

        .content-title .title ul li {
            font-size: 12px;
            display: inline-block;
            margin: 0 8px;
            padding: 4px 10px;
            background: rgba(16, 142, 233, .6);
            border-radius: 5px;
            color: #fff;
            cursor: pointer;
        }

        .content-title .title ul li:hover {
            background: #1ab394;
        }

        .content-title .range {
            margin-top: 10px;
        }

        .content-title .range .layui-form-item label {
            font-size: 12px;
            padding: 6px;
            background: #FBFBFB;
            border: 1px #E8E8E8 solid;
            margin-left: 8px;
            width: initial;
        }

        .content-title .range select {
            width: 80px;
            border: 1px #ccc solid;
            font-size: 10px;
            color: #333;
        }

        .content-title .range select option {
            font-size: 10px;
        }

        .content-title .range input {
            width: 110px;
            height: 34px;
            border: none;
            font-size: 12px;
            border: 1px #ccc solid;
            border-left: none;
            text-indent: 6px;
        }

        .content-title .range div {
            display: inline-block;
            margin-bottom: 0;
        }

        .content-title .canal {
            margin-top: 5px;
        }

        .content-cont {
            /*width: 1200px;*/
            padding: 20px 20px 30px;
            background: #fff;
            margin: 30px auto;
        }

        .content-cont .top_btn .top_more {
            display: inline-block;
            position: relative;
            width: 200px;
        }

        .content-cont .top_btn .top_more button b {
            font-size: 10px;
            color: #fff;
            margin-left: 4px;
        }

        .content-cont .top_btn .top_more ul {
            width: 220px;
            text-align: center;
            padding: 10px;
            background: #fff;
            box-shadow: 0px 0px 5px #ccc;
            position: absolute;
            top: 0;
            left: 114px;
            display: none;
        }

        .content-cont .top_btn .top_more ul li {
            cursor: pointer;
            height: 24px;
            line-height: 24px;
            display: inline-block;

        }

        .content-cont .top_btn .top_btnRight {
            float: right;
        }

        .pagination {
            margin: 0;
        }

        .content-cont .top_pages {
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            font-size: 0;
        }

        .content-cont .top_pages p {
            display: inline-block;
            font-size: 12px;
        }

        .content-cont .top_pages ul {
            font-size: 0;
            display: inline-block;
            float: right;
        }

        .content-cont .top_pages ul li:nth-of-type(1) {
            border: none;
            background: none;
        }

        .content-cont .top_pages ul li:nth-of-type(1):hover {
            background: none;
            color: #999;
        }

        .content-cont .top_pages ul li {
            display: inline-block;
            font-size: 12px;
            background: #fff;
            margin-left: 10px;
            line-height: 24px;
            text-align: center;
            border-radius: 6px;
            cursor: pointer;
            color: #999;
        }

        .content-cont .top_pages ul li:last-child {
            border: none;
            background: none;
        }

        .content-cont .top_pages ul li:last-child input {
            width: 50px;
            margin: 0 10px;
            border-radius: 6px;
            border: none;
            border: 1px #ccc solid;
            outline: none;
        }

        .content-cont .top_pages ul li:last-child:hover {
            background: none;
            color: #999;
        }

        .content-cont .top_pages ul li:hover {
            background: #108EE9;
            color: #fff;
        }

        .content-cont .table {
            width: 100%;
            margin-top: 10px;
        }

        .content-cont .table table {
            width: 100%;
        }

        .content-cont .table table thead tr th {
            padding: 8px;
            background: #f2f2f2;
            color: #000;
            text-align: center;
            font-weight: normal;
            border: 1px #e2e2e2 solid;
        }

        .content-cont .table table thead tr th > span {
            position: relative;
        }

        .content-cont .table table thead tr th > span i.upOrder, .upOrder1 {
            position: absolute;
            top: -4px;
            color: #888;
        }

        .content-cont .table table thead tr th > span i.dropOrder, .dropOrder1 {
            position: absolute;
            top: 5px;
            color: #888;
        }

        .content-cont .table table thead tr th:nth-of-type(1) span {
            display: inline-block;
            width: 12px;
            height: 12px;
            border: 1px #888 solid;
            background: #fff;
            margin-right: 20px;
            position: relative;
            cursor: pointer;
        }

        .content-cont .table table thead tr th:nth-of-type(1) span b {
            position: absolute;
            left: 28%;
            top: -60%;
        }

        .content-cont .table table tbody tr:hover {
            background: #f2f2f2;
        }

        .content-cont .table table tbody tr td {
            padding: 8px;
            border: 1px #e2e2e2 solid;
            text-align: center;
        }

        .content-cont .table table tbody tr td:last-child span {
            margin: 0 5px;
            color: #777;
            position: relative;
            cursor: pointer;
        }

        .content-cont .table table tbody tr td:last-child span b {
            width: 40px;
            line-height: 24px;
            background: #fff;
            position: absolute;
            bottom: -25px;
            left: -15px;
            font-weight: normal;
            font-size: 10px;
            color: #000;
            border: 1px #ccc solid;
            border-radius: 5px;
            display: none;
        }

        .modal-content {
            width: 400px;
            height: 200px;
            padding: 20px;
        }

        #LAY_layuipro select {
            height: 30px;
            border-radius: 4px;
        }

        .up_area {
            margin-top: 10px;
        }

        .up_area div input {
            width: 100%;
        }

        .layui-input {
            border-radius: 0;
        }
    </style>
</head>

<body><?php include_once TPL_PATH . 'public/nav.phtml'; ?>
<div class="">
    <div class="page-body" style="padding: 0">
        <div >
            <form action="" id="courseList">
                <div class="class-box">
                    <div class="class-box-head">
                        <div class="class-box-title">
                            <h3 class="col-md-8">课程列表</h3>
                            <div class="input-group col-md-4">
                                <input type="text" class="form-control" placeholder="可搜课程名称" id="keyword" name="keyword"
                                           value="<?php xcho($aSearch['keyword']) ?>">
                            </div>
                        </div>
                    </div>
                    <div class="content-title">
                        <div class="layui-form range">
                            <div class="layui-form-item">
                                <label class="layui-form-label">科目：</label>
                                <select name="csubject" id="csubject">
                                    <option value="">全部</option>
                                    <?php foreach ($aSubject as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['csubject']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">教材版本：</label>
                                <select name="edition" id="edition">
                                    <option value="">全部</option>
                                    <?php foreach ($aEdition as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['edition']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">年级：</label>
                                <select name="grade" id="grade">
                                    <option value="">全部</option>
                                    <?php foreach ($aGrade as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['grade']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程年份：</label>
                                <select name="cyear" id="cyear">
                                    <option value="">全部</option>
                                    <?php foreach ($aYear as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['cyear']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form range">
                            <div class="layui-form-item">
                                <label class="layui-form-label">状态：</label>
                                <select name="signup_status" id="signup_status">
                                    <option value="">全部</option>
                                    <?php foreach ($aSignUpStatus as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['signup_status']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程周期：</label>
                                <select name="season" id="season">
                                    <option value="">全部</option>
                                    <?php foreach ($aSeasonType as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['season']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程类别：</label>
                                <select name="ctype" id="ctype">
                                    <option value="">全部</option>
                                    <?php foreach ($aCourseType as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['ctype']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="btns-group">
                            <button id="search" data-url="<?php xcho($sSearchAction) ?>" class="btn btn-primary">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
                <div class="class-box">
                    <div class="class-box-head">
                        <div class="class-box-title">
                            <h3>课程列表</h3>
                        </div>
                        <div class="from-top row">
                            <div class="from-top-left col-md-5">
                                <ul>
                                    <li class="dropdown">
                                        <button type="button" class="btn btn-warning dropdown-toggle"
                                                    data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                                                        aria-expanded="false">更多操作 <span class="caret"></span></button>
                                        <ul class="dropdown-menu">
                                            <?php if (isset($aActions['edits_url'])) { ?>
                                                <li  id="more_change" url="<?php xcho($aActions['edits_url']) ?>"
                                                    urlSubmit="<?php xcho($aActions['saveList_url']) ?>"><a href="javascript:;">批量修改</a>
                                                </li>
                                            <?php } ?>
                                            <?php if (isset($aActions['dels'])) { ?>
                                                <li id="more_del"
                                                    url="<?php xcho($aActions['dels']['dels_url']) ?>"
                                                    actions="<?php xcho($aActions['dels']['actions']) ?>"><a href="javascript:;">批量删除</a>
                                                </li>
                                            <?php } ?>
                                        </ul>     
                                                   
                                    </li>
                                </ul>
                            </div>
                            <div class="from-top-right col-md-7">
                                <?php if (isset($aAction['add_url'])) { ?>
                                    <a class="btn btn-primary"
                                       href=" <?php xcho($aAction['add_url']) ?>">添加</a>
                                <?php } ?>
                                <?php if (isset($aAction['excel_url'])) { ?>
                                    <a class="btn btn-sub" id="excel" url="<?php xcho($aAction['excel_url']) ?>">导出
                                    </a>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    <div class="row pagination-wrap">
                        <div class="col-sm-6">

                            <div class="pagination-group col-sm-12">
                                <input class="form-control" style="width: 110px;" type="number" min="1"
                                       max="<?php xcho($iMaxPage) ?>" name="now_page" placeholder="请输入页码"
                                       value="<?php xcho($iNowPage) ?>"/>
                                <span>共搜索到<?php xcho($iTotalNum) ?>条记录</span>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <ul class="pagination">
                                <?php xchoHtml($aOrderCourse->render()) ?>
                            </ul>
                        </div>
                    </div>
                    <div class="class-box-body">
                        <table class="layui-form table table-bordered table-hover table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th><input type="checkbox" lay-filter="allChoose" lay-skin="primary" name="checkAll">
                                </th>
                                <th>课程名称</th>
                                <th>状态</th>
                                <th>课程类别</th>
                                <th>科目</th>
                                <th>年级</th>
                                <th>教材版本</th>
                                <th>课程周期</th>
                                <th>课程年份</th>
                                <th>价格</th>
                                <th>总小时</th>
                                <th id="kech_ht" style="cursor: pointer;" urlDesc="<?php xcho($aOrderURLs[1]) ?>"
                                    urlAsc="<?php xcho($aOrderURLs[2]) ?>"
                                    order="<?php $iOrderBy % 2 ? xcho('urlDesc') : xcho('urlAsc'); ?>">课程后台ID <span><i
                                                class="upOrder glyphicon glyphicon-triangle-top"></i><i
                                                class="dropOrder glyphicon glyphicon-triangle-bottom"></i></span></th>
                                <th id="gw_kech" style="cursor: pointer;" urlDesc="<?php xcho($aOrderURLs[3]) ?>"
                                    urlAsc="<?php xcho($aOrderURLs[4]) ?>"
                                    order="<?php $iOrderBy % 2 ? xcho('urlDesc') : xcho('urlAsc'); ?>">官网课程ID <span><i style="position: relative;" 
                                                class="upOrder1 glyphicon glyphicon-triangle-top"></i><i style="position: relative;"
                                                class="dropOrder1 glyphicon glyphicon-triangle-bottom"></i></span></th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($aOrderCourse as $aKey) { ?>
                                <?php foreach ($aOCourse as $aCourse) { ?>
                                    <?php if ($aCourse['id'] == $aKey['id']) { ?>
                                        <tr>
                                            <td><input type="checkbox" lay-filter="itemChoose" name="ck"
                                                       lay-skin="primary"
                                                       id="<?php xcho($aCourse['id']) ?>"></td>
                                            <td>
                                                <a href="<?php xcho($aCourse['view_url']) ?>" style="color: blue"><?php xcho($aCourse['cname']) ?></a>
                                            </td>
                                            <td><?php xcho($aCourse['signup_status_str']) ?></td>
                                            <td><?php xcho($aCourse['ctype_str']) ?></td>
                                            <td><?php xcho($aCourse['csubject_str']) ?></td>
                                            <td>
                                                <?php if(is_array($aCourse['grade_str']) && !empty($aCourse['grade_str'])){?>
                                                    <?php foreach ($aCourse['grade_str'] as $aTmp) { ?>
                                                        <?php xcho($aTmp) ?>
                                                    <?php } ?>
                                                <?php } ?>
                                            </td>
                                            <td>
                                                <?php if(is_array($aCourse['edition_str']) && !empty($aCourse['edition_str'])){?>
                                                    <?php foreach ($aCourse['edition_str'] as $aTmp) { ?>
                                                        <?php xcho($aTmp) ?>
                                                    <?php } ?>
                                                <?php } ?>
                                            </td>
                                            <td>
                                                <?php if(is_array($aCourse['season_str']) && !empty($aCourse['season_str'])){?>
                                                    <?php foreach ($aCourse['season_str'] as $aTmp) { ?>
                                                        <?php xcho($aTmp) ?>
                                                    <?php } ?>
                                                <?php } ?>
                                            </td>
                                            <td>
                                                <?php if(is_array($aCourse['cyear']) && !empty($aCourse['cyear'])){?>
                                                    <?php foreach ($aCourse['cyear'] as $aTmp) { ?>
                                                        <?php xcho($aTmp) ?>
                                                    <?php } ?>
                                                <?php } ?>
                                            </td>
                                            <td><?php xcho($aCourse['price']) ?></td>
                                            <td><?php xcho($aCourse['duration']) ?></td>
                                            <td><?php xcho($aCourse['ht_id']) ?></td>
                                            <td><?php xcho($aCourse['gw_id']) ?></td>
                                            <td>
                                                <?php if (isset($aCourse['edit_url'])) { ?>
                                                    <a class="layui-btn layui-btn-mini" lay-event="edit"
                                                       href="<?php xcho($aCourse['edit_url']) ?>">
                                                        编辑
                                                    </a>
                                                <?php } ?>
                                                <?php if (isset($aCourse['del'])) { ?>
                                                    <button class="layui-btn layui-btn-danger layui-btn-mini courseDel"
                                                            lay-event="del"
                                                            url="<?php xcho($aCourse['del']['del_url']); ?>"
                                                            keyid="<?php xcho($aCourse['id']) ?>"
                                                            actions="<?php xcho($aCourse['del']['actions']) ?>">
                                                        删除
                                                    </button>
                                                <?php } ?>
                                            </td>
                                        </tr>
                                    <?php } ?>
                                <?php } ?>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</div>
<div id="kc_modal" style="display: none;">
    <select name="quickedit_field" class="small" style="width: 100%">
        <!-- <option>请选择</option>
         <option value="courseName" relvalue="1">课程名称</option>
        -->
    </select>
    <div class="up_area" style="width: 100%;margin-top: 20px;">
        <!--<div id="quickedit_field0" style="display: none;">&nbsp;</div>
        <div id="quickedit_field_courseName" uitype="1" style="display: none;">
            <input type="text" tabindex="1" name="quickedit_value_courseName" id="courseName" value=""
                   class="detailedViewTextBox">
        </div>-->
    </div>
</div>

<script src="<?php xcho(loadSource('/assets/plugins/jquery/jquery.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layui/layui.all.js')) ?>" charset="utf-8"></script>
<script src="<?php xcho(loadSource('/assets/plugins/bootstrap/js/bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/jquery.dataTables.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/dataTables.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layer-v3.0.3/layer/layer.js')) ?>"></script>
<script
        src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/dataTables.responsive.min.js')) ?>"></script>
<script
        src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/responsive.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.core.js')) ?>"></script>
<script type="text/javascript"
        src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.excheck.js')) ?>"></script>
<script type="text/javascript"
        src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.exedit.js')) ?>"></script>
<script>
    $(function () {
        $(".top_more").hover(function () {
            $(this).find("ul").show();
        }, function () {
            $(this).find("ul").hide();
        })
        layui.use('form', function () {
            var form = layui.form;
            form.on('checkbox(allChoose)', function (data) {
                var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                child.each(function (index, item) {
                    item.checked = data.elem.checked;
                });
                form.render('checkbox');
            });
            form.on('checkbox(itemChoose)', function (data) {
                var sib = $(data.elem).parents('table').find('tbody input[type="checkbox"]:checked').length;
                var total = $(data.elem).parents('table').find('tbody input[type="checkbox"]').length;
                if (sib == total) {
                    $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", true);
                    form.render();
                } else {
                    $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", false);
                    form.render();
                }
            });
        });

        $("#excel").on('click', function () {
            var jsonData = $("form").serializeArray();
            $.ajax({
                url: $(this).attr('url'),
                data: jsonData,
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.success == 1) {
                        window.open(data.data);
                    } else {

                    }
                },
                complete: function () {
                },
                error: function () {

                }
            });
        });

        //搜索-form表单提交
        $("#search").click(function () {
            $("input[name='now_page']").val($("input:focus").val());
            $("#courseList").submit();
        })
        $("#search").bind('keyup', function (event) {
            if (event.keyCode == "13") {
                $("input[name='now_page']").val($("input:focus").val());
                //回车执行查询
                $('#search').click();
            }
        })
        //数组去重
        Array.prototype.unique3 = function () {
            var res = [];
            var json = {};
            for (var i = 0; i < this.length; i++) {
                if (!json[this[i]]) {
                    res.push(this[i]);
                    json[this[i]] = 1;
                }
            }
            return res;
        }
        //批量修改
        $("#more_change").click(function () {
            var arrs = [];
            $('input[name="ck"]:checked').each(function () {
                arrs.push($(this).attr('id'));
            });
            if (arrs.length == 0) {
                layer.alert("至少选择一项");
            } else {
                layer.open({
                    type: 1
                    , title: false //不显示标题栏
                    , closeBtn: false
                    , area: '300px;'
                    , shade: 0.8
                    , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    , btn: ['保存', '取消']
                    , moveType: 1 //拖拽模式，0或者1
                    , content: '<div style="padding: 50px; line-height: 22px;  font-weight: 300;">' +
                    $("#kc_modal").html() +
                    '</div>'
                    , success: function (layero) {
                        arrs = arrs.unique3();
                        var changeUrl = $("#more_change").attr("url");
                        //批量修改渲染接口
                        $.ajax({
                            url: changeUrl,
                            traditional: true,
                            type: 'POST',
                            dataType: 'json',
                            success: function (data) {
                                changeApply(data);//批量修改渲染
                            }
                        })
                        var select_data = {};
                        var btn = layero.find('.layui-layer-btn');
                        btn.css('text-align', 'center');
                        btn.find('.layui-layer-btn0').on("click", function () {
                            var parentWrap = btn.closest('.layui-layer');
                            //console.log("#"+select_option)
                            var a = "#quickedit_field_" + select_option;
                            var elInput = parentWrap.find(a).find('input');
                            // select_data[select_option] = elInput.val();
                            select_data[select_option] = elInput.val();
                            var urlSubmit = $("#more_change").attr("urlSubmit");
                            //批量修改保存接口
                            $.ajax({
                                url: urlSubmit,
                                data: {
                                    ids: arrs,
                                    data: select_data
                                },
                                type: 'POST',
                                dataType: 'json',
                                success: function (data) {
                                    if (data.success == 1) {
                                        $(".small").text("");
                                        $(".up_area").text("");
                                        layer.msg("修改成功");
                                        setTimeout(function(){ window.location.reload(); }, 1000);
                                    } else {
                                        layer.msg("修改失败");
                                    }
                                }
                            })
                        })
                    }
                })
            }
        });
        //批量修改渲染
        function changeApply(data) {
            var str = "", strs = '';
            $.each(data, function (i, dataVal) {
                str += '<option value=' + dataVal.val + ' type=' + dataVal.type + '>' + dataVal.name + '</option>'
                if (dataVal.type == "text") {
                    strs += '<div id="quickedit_field_' + dataVal.val + '" uitype="1" style="display:none;">'
                        + '<input type="text" tabindex="1" name="quickedit_value_' + dataVal.val + '" id="' + dataVal.val + '" value="" class="detailedViewTextBox">'
                        + '</div>'
                } else if (dataVal.type == "select") {
                    strs += '<select id="quickedit_field_' + dataVal.val + '" tabindex="1811111" style="display:none;">'
                    $.each(dataVal.data_list, function (n, listVal) {
                        strs += '<option value=' + listVal.dict_value + '>"' + listVal.cn_name + '"</option>'
                    })
                    strs += '</select>'
                }
            })
            $(".small").html(str);
            $(".up_area").html(strs);
            $(".small").change(function () {
                var selectedVal = $(this).find("option:selected").attr("value");
                var e = "#quickedit_field_" + selectedVal;
                $("div[id*='quickedit_field_']").css("display", "none");
                $("select[id*='quickedit_field_']").css("display", "none");
                $("#LAY_layuipro").find(e).fadeIn();
                select_option = selectedVal;
                select_element = e;
            })
            // console.log(select_option);
            $(".up_area>select").change(function () {
                var selectedVal_childs = $(this).find("option:selected").attr("value");
                select_option_vals = selectedVal_childs;
            })
        }

        //批量删除
        var arr = [];
        $("#more_del").click(function () {
            $("table>tbody>tr>td>div").each(function () {
                if ($(this).hasClass("layui-form-checked")) {
                    var checkboxID = $(this).prev("input").attr("id");
                    arr.push(checkboxID);
                }
            })
            if (arr.length == 0) {
                layer.alert("至少选择一项");
            } else {
                layer.confirm('确定批量删除吗？', {icon: 3, title:'提示'}, function(index){
                    //点击确定批量删除
                    $(".layui-layer-dialog>.layui-layer-btn>a.layui-layer-btn1").click(function () {
                        arr = arr.unique3();
                        var delUrl = $("#more_del").attr("url"),
                            actions = $("#more_del").attr("actions");
                        $.ajax({
                            url: delUrl,
                            data: {
                                ids: arr,
                                actions: actions
                            },
                            type: 'POST',
                            dataType: 'json',
                            success: function (data) {
                                if (data.success == 1) {
                                    layer.msg("删除成功");
                                    setTimeout(function(){ window.location.reload(); }, 3000);
                                } else {
                                    layer.msg("删除失败");
                                }
                            }
                        })
                    })
                });
            }
        })

        //删除
        $(".courseDel").click(function () {
            var delVal = $(this).attr("url"),
                keyId = $(this).attr("keyid"),
                actions = $(this).attr("actions");
            layer.confirm('确定删除吗？', {icon: 3, title:'提示'}, function(index){
                $.ajax({
                    url: delVal,
                    data: {
                        id: keyId,
                        actions: actions
                    },
                    type: 'POST',
                    dataType: 'json',
                    success: function (data) {
                        console.log(data);
                        if (data.success == 1) {
                            layer.msg("删除成功");
                            setTimeout(function(){ window.location.reload(); }, 3000);
                        } else {
                            layer.msg("删除失败");
                        }
                    }
                })
            });
        })
        //课程后台排序
        $(".upOrder").click(function () {
            var sUrl = $("#kech_ht").attr("urlDesc");
            location.href = sUrl;
        })
        $(".dropOrder").click(function () {
            var jUrl = $("#kech_ht").attr("urlAsc");
            location.href = jUrl;
        })
        //官网课程排序
        $(".upOrder1").click(function () {
            var sUrl = $("#gw_kech").attr("urlDesc");
            location.href = sUrl;
        })
        $(".dropOrder1").click(function () {
            var jUrl = $("#gw_kech").attr("urlAsc");
            location.href = jUrl;
        })
    });
</script>
<?php include_once TPL_PATH . 'public/foot_script.phtml'; ?>
<button id="top" style="height: 50px;width: 50px;"></button></body>

</html>
